LanguageExt.Core

LanguageExt.Core TypeClasses ChoiceAsync

Contents

interface ChoiceAsync <CH, L, R> Source #

class TypeClass Source #

Methods

method Task<R> matchUntypedAsync <CHOICE, CH, A, B, R> (CH ma, Func<object, R> Left, Func<object, R> Right, Func<R> Bottom = null) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Match operation with an untyped value for Some. This can be useful for serialisation and dealing with the IOptional interface

Parameters

type R

The return type

param Some

Operation to perform if the option is in a Some state

param None

Operation to perform if the option is in a None state

returns

The result of the match operation

method Task<Arr<B>> toArrayAsync <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Convert the Option to an enumerable of zero or one items

Parameters

param ma

Option

returns

An enumerable of zero or one items

method Task<Lst<B>> toListAsync <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Convert the Option to an immutable list of zero or one items

Parameters

param ma

Option

returns

An immutable list of zero or one items

method Task<IEnumerable<B>> toSeqAsync <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Convert the Option to an enumerable sequence of zero or one items

Parameters

type A

Bound value type

param ma

Option

returns

An enumerable sequence of zero or one items

method EitherAsync<A, B> toEitherAsync <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Convert the structure to an Either

method OptionAsync<B> toOptionAsync <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Convert the structure to a Option

method Task<R> matchAsync <CHOICE, CH, A, B, R> (CH ma, Func<A, Task<R>> LeftAsync, Func<B, R> Right) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

method Task<R> matchAsync <CHOICE, CH, A, B, R> (CH ma, Func<A, R> Left, Func<B, Task<R>> RightAsync) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

method Task<R> matchAsync <CHOICE, CH, A, B, R> (CH ma, Func<A, Task<R>> LeftAsync, Func<B, Task<R>> RightAsync) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

method Task<B> ifLeftAsync <CHOICE, CH, A, B> (CH ma, Func<B> Left) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

method Task<B> ifLeftAsync <CHOICE, CH, A, B> (CH ma, Func<A, B> Left) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

method Task<B> ifLeftAsync <CHOICE, CH, A, B> (CH ma, B Right) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

method Task<Unit> ifLeftAsync <CHOICE, CH, A, B> (CH ma, Action<A> Left) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

method Task<Unit> ifRightAsync <CHOICE, CH, A, B> (CH ma, Action<B> Right) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

method Task<A> ifRightAsync <CHOICE, CH, A, B> (CH ma, A Left) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Returns the leftValue if the Either is in a Right state. Returns the Left value if the Either is in a Left state.

Parameters

param Left

Value to return if in the Left state

returns

Returns an unwrapped Left value

method Task<A> ifRightAsync <CHOICE, CH, A, B> (CH ma, Func<A> Right) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Returns the result of Right() if the Either is in a Right state. Returns the Left value if the Either is in a Left state.

Parameters

param Right

Function to generate a Left value if in the Right state

returns

Returns an unwrapped Left value

method Task<A> ifRightAsync <CHOICE, CH, A, B> (CH ma, Func<B, A> Right) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Returns the result of rightMap if the Either is in a Right state. Returns the Left value if the Either is in a Left state.

Parameters

param Right

Function to generate a Left value if in the Right state

returns

Returns an unwrapped Left value

method Task<Lst<B>> rightToListAsync <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Project the Either into a Lst R

Parameters

returns

If the Either is in a Right state, a Lst of R with one item. A zero length Lst R otherwise

method Task<Arr<B>> rightToArrayAsync <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Project the Either into an Arr R

Parameters

returns

If the Either is in a Right state, a ImmutableArray of R with one item. A zero length ImmutableArray of R otherwise

method Task<Lst<A>> leftToListAsync <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Project the Either into a Lst R

Parameters

returns

If the Either is in a Right state, a Lst of R with one item. A zero length Lst R otherwise

method Task<Arr<A>> leftToArrayAsync <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Project the Either into an ImmutableArray R

Parameters

returns

If the Either is in a Right state, a ImmutableArray of R with one item. A zero length ImmutableArray of R otherwise

method Task<Seq<B>> rightAsEnumerableAsync <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Project the Either into a IEnumerable R

Parameters

returns

If the Either is in a Right state, a IEnumerable of R with one item. A zero length IEnumerable R otherwise

method Task<Seq<A>> leftAsEnumerableAsync <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Project the Either into a IEnumerable L

Parameters

returns

If the Either is in a Left state, a IEnumerable of L with one item. A zero length IEnumerable L otherwise

method Task<int> hashCodeAsync <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

method Task<IEnumerable<A>> leftsAsync <CHOICE, CH, A, B> (IEnumerable<CH> ma) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Extracts from a list of 'Either' all the 'Left' elements. All the 'Left' elements are extracted in order.

Parameters

type L

Left

type R

Right

param ma

Either list

returns

An enumerable of L

method Task<Seq<A>> leftsAsync <CHOICE, CH, A, B> (Seq<CH> ma) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Extracts from a list of 'Either' all the 'Left' elements. All the 'Left' elements are extracted in order.

Parameters

type L

Left

type R

Right

param ma

Either list

returns

An enumerable of L

method Task<IEnumerable<B>> rightsAsync <CHOICE, CH, A, B> (IEnumerable<CH> ma) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Extracts from a list of 'Either' all the 'Right' elements. All the 'Right' elements are extracted in order.

Parameters

type L

Left

type R

Right

param ma

Choice list

returns

An enumerable of L

method Task<Seq<B>> rightsAsync <CHOICE, CH, A, B> (Seq<CH> ma) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Extracts from a list of 'Either' all the 'Right' elements. All the 'Right' elements are extracted in order.

Parameters

type L

Left

type R

Right

param ma

Choice list

returns

An enumerable of L

method Task<(IEnumerable<A> Lefts, IEnumerable<B> Rights)> partitionAsync <CHOICE, CH, A, B> (IEnumerable<CH> ma) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Partitions a list of 'Either' into two lists. All the 'Left' elements are extracted, in order, to the first component of the output. Similarly the 'Right' elements are extracted to the second component of the output.

Parameters

type L

Left

type R

Right

param ma

Choice list

returns

A tuple containing the an enumerable of L and an enumerable of R

method Task<(Seq<A> Lefts, Seq<B> Rights)> partitionAsync <CHOICE, CH, A, B> (Seq<CH> ma) Source #

where CHOICE : struct, ChoiceAsync<CH, A, B>

Partitions a list of 'Either' into two lists. All the 'Left' elements are extracted, in order, to the first component of the output. Similarly the 'Right' elements are extracted to the second component of the output.

Parameters

type L

Left

type R

Right

param ma

Choice list

returns

A tuple containing the an enumerable of L and an enumerable of R